<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>密码修改</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="../../plugins/mui/mui.min.css">
		<script src="../../js/statistics.js"></script>
		<style type="text/css">
			 *{
            box-sizing: border-box;
            font-family: 'Microsoft YaHei';
	        }
	        body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, form,  input, p, table, th, td ,select,option{
	            padding: 0;
	            margin: 0;
	            list-style: none;
	        }
	        body{
	        	padding-top:45px;
	        	padding-bottom:10px;
	        }
			/*title的样式覆盖*/
			.mui-bar{
				background-color:#2a2c33;
				top:0;
			}
			.mui-bar>a{
				color:#fff;
			}
			.mui-title{
				color:#fff;
			}
			/*列表数字角标移动防止盖住右箭头*/
			.mui-table-view:before{
				display:none;
			}
			.mui-table-view:after{
				display:none;
			}
			.mui-table-view-cell:after{
				background-color:#e5e5e5;
			}
			
			/*百分比优化*/
			.mui-table-view-cell {
				padding: 11px 4%;
			}
			.mui-table-view-cell>a:not(.mui-btn){
				margin: -11px -4%;
			}
			.mui-navigate-right:after, .mui-push-right:after {
				right: 4%;
				
			}
			.mui-switch .mui-switch-mini{
				right:4%;
			}
			/*开关 off on替换 开关*/
			/*.mui-switch.mui-active:before{
				content:'开';
			}
			.mui-switch:before{
				content:'关';
			}*/
			.mui-input-row>img{
				float:left;
			}
			.mui-input-group:before{
				display:none;
			}
			.mui-input-group:after{
				display:none;
			}
			.mui-input-group .mui-input-row:after{
				display:none;
			}
			.mui-input-row{
				padding-left:3%;
				padding-right:3%;
			}
			.mui-input-row>input{
				border:none;
			}
			.mui-input-clear{
				padding: 11px 4%!important;
				
			}
			.mui-input-row .mui-input-clear~.mui-icon-clear{
				right:4%;
			}
			.mui-btn{
				display:block;
				width:94%;
				padding-left: 3%;
				padding-right: 3%;
				margin:0 auto;
				height:40px;
				background-color: #43AC45;
				border-color:#43AC45;
				font-size: 15px;
			}
		</style>
	</head>
	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">密码修改</h1>
		</header>
		
		    <div class="mui-input-row" style='margin-top:10px;'>
		        <input type="password" class="mui-input-clear"    placeholder="原始密码" style='line-height: 20px;' id='input1' maxlength="16">
		    </div>
		    <div class="mui-input-row">
		        <input type="password" class="mui-input-clear" placeholder="新的密码" style='line-height: 20px;' id='input2' maxlength="16">
		    </div>
		    <div class="mui-input-row">
		        <input type="password" class="mui-input-clear" placeholder="确认密码" style='line-height: 20px;' id='input3' maxlength="16">
		    </div>
			<button type="button" class="mui-btn mui-btn-success" id='submit1'>确认修改</button>
		
		
		<script src="../../plugins/mui/mui.min.js"></script>
		<!--<script type="text/javascript" src="../plugins/mui/update.js"></script>-->
		<script src="../../js/getApiToken.js"></script>
		<script src="../../js/md5.js"></script>
		<script type="text/javascript">
			mui.init({
   				
	  		});

	  		
	  		mui.plusReady(function() {
				  //关闭等待框
				plus.nativeUI.closeWaiting();
				    //显示当前页面
				mui.currentWebview.show('slide-in-right',200);
				
				submit1.addEventListener('tap',function(){
					var a=new RegExp(/[\u4e00-\u9fa5]/);
					
					if(!input1.value.trim()){
						mui.toast('原始密码不能为空');
					}else if(input2.value.trim().length<6){
						mui.toast('新的密码不能少于6位');
					}else if(!input2.value){
						mui.toast('新的密码不能为空');
					}else if(!input3.value){
						mui.toast('确认密码不能为空');
					}else if(input3.value!=input2.value){
						mui.toast('两次密码不相同,请重新输入');
					}else if(a.test(input3.value)){
						mui.toast('新的密码不能有中文');
					}else if(input3.value==input1.value){
						mui.toast('新的密码不能跟旧密码相同');
					}else{
						plus.nativeUI.showWaiting('密码修改中...');
						  myAjax('personal/user/changePassword', 'post', {
								'user_id': plus.storage.getItem('cg_user_id'),
								'user_token': plus.storage.getItem('cg_user_token'),
								'password':input1.value.trim(),
								'new_password':input2.value
							}, function(data) {
								plus.nativeUI.closeWaiting();
								if(data.success){
									mui.toast('密码修改成功');
									plus.webview.currentWebview().close();
									
								}else{
//									plus.webview.currentWebview().close();
									mui.toast(data.error_msg);
								}
							})
						//开始验证密码
	//					plus.nativeUI.showWaiting('上传中...');

					}
					
					
				})
			});
	  		
			
		</script>
	</body>
</html>


